﻿using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZFS.Model;
using ZFSDomain.SysModule;

namespace ZFSDomain.ViewModel.Dictionary
{
    public class DictionaryDialogViewModel : BaseDialogOperation
    {
        public DictionaryDialogViewModel()
        {
            Dictionary = new tb_Dictionary();
        }

        /// <summary>
        /// 类型集合
        /// </summary>
        public List<tb_DictionaryType> TypeList { get; set; }
        
        private tb_Dictionary dictionary;
        
        /// <summary>
        /// 字典内容
        /// </summary>
        public tb_Dictionary Dictionary
        {
            get { return dictionary; }
            set { dictionary = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 保存
        /// </summary>
        public override void Save()
        {
            if (Dictionary.DataCode == null)
            {
                return;
            }

            if (Dictionary.NativeName == null)
            {
                return;
            }
            
            this.Result = true;
            Messenger.Default.Send("", "CloseWindow");
        }

    }
}
